
@model Abc.Core.SysSettingDto
@{
}
<form class="layui-form" action="" onsubmit="return false">

    <table class="layui-table">
        <tbody class="layui-text">
            <tr>
                <td>网站名称</td>
                <td><input type="text" asp-for="WebName" required lay-verify="required" placeholder="请输入网站名称" autocomplete="off" class="layui-input"></td>
                <td>网站URL地址</td>
                <td><input type="text" asp-for="WebUrl" lay-verify="url" placeholder="请输入网站URL地址" autocomplete="off" class="layui-input"></td>
            </tr>
            <tr>
                <td>网站Logo</td>
                <td>
                    <input type="hidden" asp-for="WebLogo" />
                    <div class="layui-upload">
                        <button type="button" class="layui-btn" id="btn_WebLogo">上传图片</button>
                        <div class="layui-upload-list">
                            @if (string.IsNullOrWhiteSpace(@Model?.WebLogo))
                            {
                                <img class="layui-upload-img" id="upload_WebLogo" style="height: auto; width: 100px;">
                            }
                            else
                            {
                                <img class="layui-upload-img" id="upload_WebLogo" style="height: auto; width: 100px;" src="@(ViewBag.Domain)@(@Model.WebLogo)">
                            }

                        </div>
                    </div>

                </td>
                <td>版权信息</td>
                <td><textarea asp-for="CopyrightInformation" placeholder="请输入版权信息" class="layui-textarea"></textarea></td>
            </tr>
            <tr>
                <td>MATE网站关键词</td>
                <td><textarea asp-for="MetaKeywords" placeholder="请输入MATE网站关键词" class="layui-textarea"></textarea></td>

                <td>MATE网站描述</td>
                <td><textarea asp-for="MetaDescribe" placeholder="请输入MATE网站描述" class="layui-textarea"></textarea></td>

            </tr>
            <tr>

                <td>网站备案号</td>
                <td colspan="3"><input type="text" asp-for="WebBeianNo" placeholder="请输入网站备案号" autocomplete="off" class="layui-input"></td>

            </tr>


            <tr>
                <td></td>
                <td>
                    <div class="layui-input-block">
                        <button class="layui-btn submitbtn" lay-submit lay-filter="formDemo">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </td>
                <td></td>
            </tr>

        </tbody>
    </table>


    <div class="layui-form-item">
    </div>
</form>
@section scripts{
    <script>
        layui.use(['tinymce', 'form'], function() {
            var form = layui.form;
            var tinymce = layui.tinymce;
            var $ = layui.jquery;

            var webBeianNo = abc.tinymceInit({ elem: 'WebBeianNo', url: '@(Url.Action("FileUpload"))' });
            form.on('submit(formDemo)', function(obj) {
                // layer.msg(JSON.stringify(data.field));
                obj.field.WebBeianNo = webBeianNo.getContent();
                abc.post({ url: "@(Url.Action("SystemSetting"))", data: obj.field })
                return false;
            });
            //初始化图片上传
            //abc.InitUpLoadImage(upload, '@(Url.Action("ImgUpload"))?type=Ad', 'btn_WebLog', 'WebLog', 'upload_WebLog');
            abc.initFileUpLoad({
                elem: "btn_WebLogo", auto: true, url: '@(Url.Action("ImgUpload"))?type=images'
                , done: function(res, index, upload) {
                    $('#WebLogo').val(res.Data.src);
                    $('#upload_WebLogo').attr('src', res.Data.httpsrc);
                    $('#upload_WebLogo').html(res.Data.httpsrc);
                    console.log(res);
                }
                , error: function(index, upload) {
                }
            });
        });
    </script>
}
